Estoy migrando de js a ts y también de mongoose 5.8 a 6.1 El siguiente código funcionaba bien antes
let getActionsTakenByApp = (store_url: string) => { return AppAction.aggregate([ { $match: { store_url } }, { $group: { _id: { 'action_type': '$action_type' }, count: { $sum: 1 } } } ]); }Pero ahora mecanografiado ahora muestra este error.
Type '{ _id: { action_type: string; }; count: { $sum: number; }; }' is not assignable to type '{ [key: string]: { $count?: any; $accumulator?: any; $addToSet?: any; $avg?: any; $first?: any; $last?: any; $max?: any; $mergeObjects?: any; $min?: any; $push?: any; $stdDevPop?: any; $stdDevSamp?: any; $sum?: any; }; _id: any; }'. Property '_id' is incompatible with index signature. Type '{ action_type: string; }' is not assignable to type '{ $count?: any; $accumulator?: any; $addToSet?: any; $avg?: any; $first?: any; $last?: any; $max?: any; $mergeObjects?: any; $min?: any; $push?: any; $stdDevPop?: any; $stdDevSamp?: any; $sum?: any; }'. Object literal may only specify known properties, and ''action_type'' does not exist in type '{ $count?: any; $accumulator?: any; $addToSet?: any; $avg?: any; $first?: any; $last?: any; $max?: any; $mergeObjects?: any; $min?: any; $push?: any; $stdDevPop?: any; $stdDevSamp?: any; $sum?: any; }'.ts(2322)Todavía soy nuevo en mecanografiar y trato de descubrir cuál es el problema. ¡Cualquier ayuda sería apreciada! ¡¡Gracias!!
Es un error introducido en 6.1.0
Se solucionará una vez que las relaciones públicas relacionadas se fusionen y se lancen.
Mientras tanto, puede cambiar a una versión anterior.